<!-- 成绩管理-选修课成绩管理 -->
<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
		<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
		<link rel="stylesheet" href="/css/font.css">
		<link rel="stylesheet" href="/css/xadmin.css">
	</head>

	<body>
		<div class="x-body" id="app">
			<table class="layui-table layui-form">
				<thead>
					<tr>
						<th>课程代码</th>
						<th>课程名称</th>
						<th width="60">课程性质</th>
						<th width="150">操作</th>
				</thead>
				<tbody>
					<tr v-for="tchCourse in tchCourses">
						<td>{{ tchCourse.courseNo }}</td>
						<td>{{ tchCourse.courseName }}</td>
						<td v-if="tchCourse.courseType == 2">专业选修</td>
						<td class="td-manage">
                            <button class="layui-btn layui-btn layui-btn-sm" onclick="open_scoreManager(this)" :data-courseName="tchCourse.courseName" :data-tchCourseId="tchCourse.id"><i class="layui-icon">&#xe63c;</i>成绩管理</button>
                        </td>
					</tr>
				</tbody>
			</table>
		</div>
		<script type="text/javascript" src="/js/jquery.min.js"></script>
        <script type="text/javascript" src="/js/xadmin.js"></script>
        <script type="text/javascript" src="/lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="/js/vue.min.js"></script>
        <script type="text/javascript" src="/js/jquery.form.js"></script>
        <script >
	        var vm = new Vue({
	            el : '#app',
	            data : {
	                // 选修课程列表
	                tchCourses : ""
	            },
	            created : function() {
	                // 获取教师教授的选修课程列表
	                this.listMinorTchCourse();
	            },
	            methods : {
	            	listMinorTchCourse: function() {
	                    var vm = this;
	                    $.ajax({
	                        url : "/teacher/score/listMinorTchCourse",
	                        type : "get",
	                        success : function(result) {
	                            if (result.state) {
	                                vm.tchCourses = result.data;
	                            } else {
	                                layui.use(['layer'], function(){
	                                    var layer = layui.layer
	                                    layer.msg(""+result.msg, {icon: 5});
	                                });
	                            }
	                        }
	                    });
	                }
	            }
	        });
	        
	        // 打开成绩管理页面
	        function open_scoreManager(obj) {
	        	var courseName = $(obj).attr("data-courseName");
	        	var tchCourseId = $(obj).attr("data-tchCourseId");
                x_admin_show('成绩管理【'+ courseName +'】','/teacher/score/toMinorStudent_list?tchCourseId=' + tchCourseId, 600, 430);
	        }
        </script>
	</body>

</html>
